<template>
	<view class="" style="background-color: #d70127;">
		<view class="content">
			<view class="header df-sa">
				<view class="" style="font-size: 36rpx;">
					<view class=""> 可提现金额 </view>
					<view class="" style="font-size: 48rpx;"> {{canMoney.memberTakeableIncomeAmount}}</view>
				</view>
				<view class="" style="font-size: 36rpx;">
					<view class=""> 锁定金额 </view>
					<view class="" style="font-size: 48rpx;"> {{canMoney.memberTakeableIncomeAmountLocked}} </view>
				</view>
			</view>
			<view class="comemode">
				<view class="title"> 收益记录 </view>
				<view class="comebox">
					<view class="comeList" v-for="(item,indexc) in datalist" :key="indexc">
						<view class="" style="padding: 14rpx 22rpx;">
							<view class="" style="display: flex;justify-content: space-between;">
								<view class="left">
									{{item.memberName}}
								</view>
								<view class="numbers"> ￥{{item.amount}}
									<text v-if="item.isLocked==0">（锁定）</text>
									<text v-if="item.isLocked==2">（回退）</text>
								</view>
							</view>
							<view class="" style="display: flex;justify-content: space-between;margin-top: 20rpx;">
								<view class="" style="font-size: 30rpx;">
									{{item.type}}
								</view>
							</view>
							<view class="" style="font-size: 30rpx;text-align: right;margin-top: 20rpx;">
								{{item.createTime}}
							</view>
						</view>
					</view>
					<!-- 		<view class="" v-if="isEmpty" style="display: flex;justify-content: center;">
					<image src="/static/image/empty.png" mode="widthFix" style="width: 500rpx;"></image>
				</view> -->
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		memberIncomeList,
		userAmount
	} from '@/request/api.js'
	export default {
		data() {
			return {
				mainData: {
					allAmount: 0
				},
				datalist: [],
				memberInfo: uni.getStorageSync('userInfo'),
				pageNo: 1,
				pageSize: 10,
				canMoney: '',
				isEmpty: false
			};
		},
		onLoad() {
			this.gettakeableIncome();
			this.getUserAmount();
		},
		onReachBottom() {
			console.log(11);
			if (this.total <= this.datalist.length) {
				uni.showToast({
					title: '已加载全部数据',
					icon: "none"
				});
			} else {
				this.pageNo++;
				this.gettakeableIncome()
			}
		},
		methods: {
			gettakeableIncome() {
				memberIncomeList({
					memberId: uni.getStorageSync('userInfo').id,
				}).then(res => {
					if (res.code == 200) {
						this.datalist = [...this.datalist, ...res.result.records]
						this.total = res.result.total; //数据总条数
						if (this.datalist.length > 0) {
							this.isEmpty = false
						} else {
							this.isEmpty = true
						}
					}
				})
			},
			getUserAmount() {
				let that = this;
				userAmount({
					userId: uni.getStorageSync('userInfo').id,
				}).then(res => {
					if (res.code == 200 && res.result) {
						that.canMoney = res.result
					}
				})
			},
		}
	}
</script>
<style>
</style>
<style lang="scss" scoped>
	.content {
		// padding-top: 50rpx;
		min-height: 100vh;
		background: url('/static/image/bg2.png') no-repeat center center;
		background-size: 100% 100%;
		padding-bottom: 200rpx;

		// overflow: hidden;
		.header {
			padding-top: 100rpx;
			text-align: center;
			color: #FDE8CE;

			.total {
				font-size: 64rpx;
				font-weight: 900;
			}

			.title {
				font-size: 56rpx;
				margin-top: 20rpx;
			}
		}

		.comemode {
			margin-top: 30rpx;
			color: #FDE8CE;

			.title {
				margin: 0 40rpx;
				font-size: 32rpx;
				font-weight: bold;
				border-bottom: 10rpx solid #FDE8CE;
				padding-bottom: 5rpx;
				display: inline-block;
			}

			// .title::after{
			// 	position: absolute;
			// }
			.comebox {
				margin: 30rpx;
				border-radius: 16rpx;

				.comeList {
					border-bottom: 1rpx solid #f1f1f1;

					.left {
						image {
							width: 64rpx;
							height: 64rpx;
							border-radius: 50%;
							vertical-align: middle;
						}

						text {
							font-size: 28rpx;
							margin-left: 32rpx;
							vertical-align: middle;
						}
					}

					.numbers {
						font-size: 28rpx;
					}
				}
			}
		}
	}
</style>